package com.smh.a01MapDemo1;

import java.util.HashMap;
import java.util.Map;

public class MapDemo1 {
    public static void main(String[] args) {

        Map<Integer,String> map = new HashMap<>();
        map.put(1,"asd");
        map.put(2,"qwe");
        map.put(3,"zxc");
        map.put(4,"fgh");
        System.out.println(map.put(5, "rty"));
        //键存在,就会覆盖原来的值,并返回
        System.out.println(map.put(1, "zxc"));
        //即便一样,也会直接覆盖
        System.out.println(map.put(1, "zxc"));
        //删除,返回值
        System.out.println(map.remove(1));
        System.out.println(map);
        //contains
        System.out.println(map.containsKey(1));
        System.out.println(map.containsValue("zxc"));
        //isEmpty
        System.out.println(map.isEmpty());
        //size
        System.out.println(map.size());

        //clear
        map.clear();
        System.out.println(map);

        //


    }
}
